package com.fable.common.configura.shiro;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@ConfigurationProperties(prefix = "shiro")
public class ShiroConfigProperties {

    private Map<String, String> filterChainDefinitionMap;

    /**
     * 未授权页面
     */
    private String unAuthorizedUrl;

    private long sessionTimeout = 60 * 60 * 1000;

    /**
     * 未认证页面
     */
    private String unAuthenticatedPage;        // 未认证转发Url

    /**
     * 未认证接口
     */
    private String unAuthenticatedApi;

    public Map<String, String> getFilterChainDefinitionMap() {
        return filterChainDefinitionMap;
    }

    public void setFilterChainDefinitionMap(Map<String, String> filterChainDefinitionMap) {
        this.filterChainDefinitionMap = filterChainDefinitionMap;
    }

    public String getUnAuthorizedUrl() {
        return unAuthorizedUrl;
    }

    public void setUnAuthorizedUrl(String unAuthorizedUrl) {
        this.unAuthorizedUrl = unAuthorizedUrl;
    }

    public long getSessionTimeout() {
        return sessionTimeout;
    }

    public void setSessionTimeout(long sessionTimeout) {
        this.sessionTimeout = this.sessionTimeout * sessionTimeout;
    }

    public String getUnAuthenticatedPage() {
        return unAuthenticatedPage;
    }

    public void setUnAuthenticatedPage(String unAuthenticatedPage) {
        this.unAuthenticatedPage = unAuthenticatedPage;
    }

    public String getUnAuthenticatedApi() {
        return unAuthenticatedApi;
    }

    public void setUnAuthenticatedApi(String unAuthenticatedApi) {
        this.unAuthenticatedApi = unAuthenticatedApi;
    }
}
